Make tooltip properties idiomatic
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 22 Apr 2020 18:32:17 +0000 (19:32 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Fri, 5 Jun 2020 19:32:26 +0000 (20:32 +0100)
commit6b096e5c5bfffab6cf3a3c2de305826bc2ea03da
tree6545f91f32efcde23848535cd61d63479b1f3244
parent9ac1eacdc898b4b0277f591810a41794b382f5ad
Make tooltip properties idiomatic

The tooltip handling in GtkWidget is "special":

 - the string is stored inside the qdata instead of the private
   instance data
 - the accessors call g_object_set() and g_object_get(), and the
   logic is all inside the property implementation, instead of
   being the other way around
 - the getters return a copy of the string
 - the setters don't really notify all the involved properties

The GtkWidgetAccessible uses the (escaped) tooltip text as a source for
the accessible object description, which means it has to store the
tooltip inside the object qdata, and update its copy at construction and
property notification time.

We can simplify this whole circus by making the tooltip properties (text
and markup) more idiomatic:

 - notify all side-effect properties
 - return a constant string from the getter
 - if tooltip-text is set:
   - store the text as is
   - escape the markup and store it separately for the markup getter
 - if tooltip-markup is set:
   - store the markup as is
   - parse the markup and store it separately for the text getter

The part of the testtooltips interactive test that checks that the
getters are doing the right thing is now part of the gtk testsuite, so
we ensure we don't regress in behaviour.
gtk/a11y/gtkwidgetaccessible.c
gtk/gtkentry.c
gtk/gtklinkbutton.c
gtk/gtkwidget.c
gtk/gtkwidget.h
gtk/gtkwidgetprivate.h
tests/testtooltips.c
testsuite/gtk/meson.build
testsuite/gtk/tooltips.c [new file with mode: 0644]